<?php
/**
 * (crontab) sp-获取请求报告（账号）
 */
namespace App\Crontab\Daily\SpApi;

use App\Jobs\AmazonApi\SpApi\GrabGetReport as GGrabGetReport;
use App\Models\Basics\AmazonAccount;
class GrabGetReport
{
    /**
     * 亚马逊报告-通用
     * @param array $where
     * @param null $reportType
     * @return void
     */
    public static function grab(array $where = [], $reportType = null){
        $where['api'] = 1;
        $accounts = AmazonAccount::optionsForApi($where);
        $re = [];
        foreach ($accounts as $account){
            GGrabGetReport::dispatch($account,$reportType)->onQueue('sp-report');
            $re[$account->id] = true;
        }
        var_dump($re);
    }
}
